package com.middlegroup.payadmin.service.impl;

import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.middlegroup.payadmin.mapper.ManagerMapper;
import com.middlegroup.payadmin.pojo.dto.DataGrid;
import com.middlegroup.payadmin.pojo.dto.ManagerDto;
import com.middlegroup.payadmin.pojo.po.Manager;
import com.middlegroup.payadmin.service.ManagerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author pc
 */
@Service
public class ManagerServiceImpl extends ServiceImpl<ManagerMapper,Manager> implements ManagerService {
	@Resource
	private ManagerMapper managerMapper;


	@Override
	public PageInfo<ManagerDto> listManagerByName(DataGrid grid, String name, String account) {
		grid.getOrderBy();
		return PageHelper.startPage(grid.getPageNum(), grid.getPageSize())
				.doSelectPageInfo(() -> this.managerMapper.listManagerByName(name,account));
	}

	@Override
	public ManagerDto selectManagerByAccount(String account) {
		ManagerDto managerDto = this.managerMapper.selectManagerByAccount(account);
		return managerDto;
	}


}
